//
//  KKBLEModel.h
//
//  Created by zorro on 2017/11/13.
//  Copyright © 2017年 zorro. All rights reserved.
//
// Device 类

#import <Foundation/Foundation.h>
#import "LKDBHelper.h"
@class CBPeripheral;

@interface KKBLEModel : NSObject

// 蓝牙硬件所涉及的数据
@property (nonatomic, strong) NSString  *bleName;                   // 设备名字
@property (nonatomic, strong) NSString  *bleNickName;               // 设备昵称
@property (nonatomic, strong) NSString  *bleUUID;                   // 设备UUID
@property (nonatomic, strong) NSString  *bleMAC;                    // 设备MAC
@property (nonatomic, strong) NSString  *bleRSSI;                   // RSSI
@property (nonatomic, strong) NSData    *bleAdv;                    // 广播
@property (nonatomic, assign) NSInteger bleVersion;                 // 固件版本
@property (nonatomic, assign) NSInteger bleAdvID;                   // 广播ID
@property (nonatomic, assign) NSInteger bleCustomerID;              // 客户ID
@property (nonatomic, assign) NSInteger bleFunction;                // 设备功能字节
@property (nonatomic, assign) NSInteger bleOnlineVersion;           // 固件在线版本
@property (nonatomic, strong) NSString  *download_url;              //固件升级链接
@property (nonatomic, strong) NSString  *chip;                      //芯片类型
@property (nonatomic, strong) CBPeripheral *peripheral;
@property (nonatomic, assign) BOOL         isConnected;             // 是否连接中
@property (nonatomic, assign) NSInteger    deviceID;                // 设备ID，硬件版本
@property (nonatomic, assign) NSInteger    batteryStatus;           // 电池状态 0为正常 1为正在充电 2为低电量.
@property (nonatomic, assign) NSInteger    batteryQuantity;         // 电池电量

@property (nonatomic, assign) BOOL isInitiative;                    // 是否主动断开的.
@property (nonatomic, assign) BOOL isBinding;                       // 是否绑定了
@property (nonatomic, assign) BOOL isRepeatConnect;                 // 是否重链接
@property (nonatomic, assign) NSInteger function;

// 传入蓝牙设备的uuid创建模型
+ (instancetype)initWithUUID:(NSString *)uuid;
// 从数据库获取模型.
+ (KKBLEModel *)getModelFromDBWtihUUID:(NSString *)uuid;

@end

